const Mock = require('mockjs')

const data = Mock.mock({
  'items|30': [{
    id: '@id',
    name: '@sentence(10, 20)',
    'genderStatus|1': ['published', 'draft', 'deleted'],
    userName: '@cname', // 生成用户名 ， 都是中国人的名字
    email: '@email',
    phone: /^1(5|3|7|8)[0-9]{9}$/, // 生成随机电话号
    image: "@Image('100x40','#c33', '#ffffff','小北鼻')", // 生成随机图片，大小/背景色/字体颜色/文字信息
    'remark|1-10': '',
    display_time: '@datetime',
    pageviews: '@integer(300, 5000)'
  }]
})

module.exports = [
  {
    url: '/demo/page',
    type: 'get',
    response: (config) => {
      const { items } = data
      return {
        code: '00000',
        data: {
          totalRows: items.length,
          rows: items,
          pageNo: 1,
          pageSize: 10,
          totalPage: 3
        }
      }
    }
  }
]
